/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gameheart.client.sprite;

import gameheart.client.sprite.CardSprite;

/**
 *
 * @author win7
 */
public class VerticalMoveState extends MoveState {

    @Override
    public void updatePosition(CardSprite card, double a, double b, double c, int speed) {
        if (isMoving(card, a, b, c)) {
            int directedSpeed = speed * (card._destY - card._srcY) / Math.abs(card._destY - card._srcY);
            double y = card.getY() + directedSpeed;
            double x = -(b * y + c) / a;
            card.setX((int) x);
            card.setY((int) y);
        }
    }
}
